import { inject, App } from 'vue';
import axios, { Axios } from 'axios';

const createHttpRequest = () => (app: App) => {
  app.provide('axios', axios);
};

const useHttpRequest = () => {
  return inject('axios') as Axios;
};

const request = createHttpRequest();

export { createHttpRequest, request, useHttpRequest };
